package com.cgycms.webdeploy.storage;

import cn.hutool.core.util.StrUtil;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @ClassName : DeployConfig
 * @Description : 系统配置类
 * @Author : 王力超
 * @Date: 2020-11-05 14:54
 */
@Component
@ConfigurationProperties(prefix = "deploy.config")
public class DeployConfig {

    private Integer retry;

    private String configPath;

    private boolean deployUp;

    private boolean deployDel;

    private boolean deployDown;

    private String fileType;

    private String downloadTemp;

    private String uploadTemp;

    private String authPath;

    private boolean logEnable;

    private String logPath;

    private String tempPath;

    public String getAuthPath() {
        return authPath;
    }

    public void setAuthPath(String authPath) {
        this.authPath = authPath;
    }

    public boolean isDeployDel() {
        return deployDel;
    }

    public void setDeployDel(boolean deployDel) {
        this.deployDel = deployDel;
    }

    public boolean isDeployDown() {
        return deployDown;
    }

    public void setDeployDown(boolean deployDown) {
        this.deployDown = deployDown;
    }

    public Integer getRetry() {
        return retry;
    }

    public void setRetry(Integer retry) {
        this.retry = retry;
    }

    public String getConfigPath() {
        return configPath;
    }

    public void setConfigPath(String configPath) {
        this.configPath = configPath;
    }

    public boolean isDeployUp() {
        return deployUp;
    }

    public void setDeployUp(boolean deployUp) {
        this.deployUp = deployUp;
    }

    public String getFileType() {
        return fileType;
    }

    public void setFileType(String fileType) {
        this.fileType = fileType;
    }

    public String getTempPath() {
        return tempPath;
    }

    public void setTempPath(String tempPath) {
        this.tempPath = tempPath;
    }

    public String getDownloadTemp() {
        if (StrUtil.isBlank(getTempPath())) {
            return "/webDeploy";
        }
        return getTempPath();
    }

    public String getUploadTemp() {
        if (StrUtil.isBlank(getTempPath())) {
            return "/webDeploy";
        }
        return uploadTemp;
    }

    public boolean isLogEnable() {
        return logEnable;
    }

    public void setLogEnable(boolean logEnable) {
        this.logEnable = logEnable;
    }

    public String getLogPath() {
        return logPath;
    }

    public void setLogPath(String logPath) {
        this.logPath = logPath;
    }
}
